<title>绑定银行卡</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<script type="text/javascript" src="#(assets)/js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="#(assets)/js/app.js"></script>
<script type="text/javascript" src="#(assets)/js/layer/layer.js"></script>
#@checkToken()
<style> 
	*{margin:0;padding:0;}
	body{font-family:"Microsoft YaHei",Arial,Helvetica,sans-serif,"宋体";}
	li{list-style-type:none;}
	select,input{-webkit-appearance:none;border:0px;
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0);   
	}
</style>
<body bgcolor="#eeeced" style="margin:0px;">
<div align=center>
	<div style="width:90%;margin-top:10px;height:50px;"> 
		<div align="center" style="float:left;width:96%;padding-left:2%;font-size:13px;line-height:20px;">
			<div style="color:#a2a2a2">您所填写的内容已经过加密处理</div>
			<div style="color:#a2a2a2">防止信息泄露和恶意扣款，请放心填写</div>
		</div>
		<br> 
	</div>
	<div>
		<div style="width:14%;background:#fd536d;height:2px;float:left;margin-left:5%"></div>
		<div style="width:6px;height:6px;border-radius:3px;background:#fd536d;float:left;margin-top:-2px;"></div>
		<div style="width:14%;background:#fd536d;height:2px;float:left;"></div>
		
		<div style="width:14%;background:#fd536d;height:2px;float:left;"></div>
		<div style="width:6px;height:6px;border-radius:3px;background:#fd536d;float:left;margin-top:-2px;"></div>
		<div style="width:14%;background:#fd536d;height:2px;float:left;"></div>
		
		<div style="width:14%;background:#dddbdc;height:2px;float:left;"></div>
		<div style="width:5px;height:5px;border-radius:3px;border:1px solid #dddbdc;float:left;margin-top:-2px;background:#FFF"></div>
		<div style="width:14%;background:#dddbdc;height:2px;float:left;"></div>
	</div> 
	<div style="clear:both;font-size:12px;">  
		<div style="width:38%;float:left;color:#fd536d">身份认证</div>
		<div style="width:25%;float:left;color:#fd536d">绑定银行卡</div>
		<div style="width:35%;float:left;color:#dddbdc">设置交易密码及授权</div>
	</div>
	<div style="height:20px;"></div>
	 
	<div onclick="window.location.href='#'" style="height:40px;width:100%;background:#FFF;margin-top:10px;">
		<div style="width:90%;">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:16px;color:#373737;line-height:24px;">真实姓名：</div>
			</div>
			<div id="real_name" style="float:left;line-height:40px;color:#939393"></div>
		</div>
	</div>
	<div onclick="window.location.href='#'" style="height:40px;width:100%;background:#FFF;">
		<div style="width:90%;border-top:1px solid #f5f5f7">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:16px;color:#373737;line-height:24px;">身份证号：</div>
			</div>
			<div id="cert_num" style="float:left;line-height:40px;color:#939393"></div>
		</div>
	</div>
	
	<div style="height:40px;width:100%;background:#FFF;margin-top:10px;">
		<div style="width:90%;">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:16px;color:#373737;line-height:24px;">开户行：</div>
			</div>
			<div style="float:right;line-height:40px;color:#939393">
				<img style="vertical-align:bottom;width:14px;margin-top:14px;float:right" src="#(assets)/images/mobile/personal_jiantou2.png">
				<select id="bank" style=";margin-top:12px;float:right;font-size:14px;color:#939393;"> 
				  <option value ="1">请选择</option>
				</select>  
			</div>
		</div>
	</div>
	<div style="height:40px;width:100%;background:#FFF;">
		<div style="width:90%;border-top:1px solid #f5f5f7">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:16px;color:#373737;line-height:24px;">卡&nbsp&nbsp&nbsp号：</div>
			</div>
			<div style="float:left;line-height:40px;width:60%;color:#939393">
				<input id="bankAccount"  placeholder="请输入银行卡储蓄卡卡号" type="text" style="font-size:14px;height:40px;width:100%">
			</div>
		</div>
	</div>

	<div align="right" style="height:30px;width:100%;float:right;font-size:13px;color:#111;line-height:30px;color:#939393;margin-right:5%;">
		查看各银行限额<img style="width:14px;margin-top:8px;float:right" src="#(assets)/images/mobile/personal_jiantou2.png">
	</div>
	
	<div onclick="window.location.href='#'" style="clear:both;height:40px;width:100%;background:#FFF;margin-top:30px;">
		<div style="width:90%;">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:16px;color:#373737;line-height:24px;">开户行所在地：</div>
			</div>
			<div style="float:right;line-height:40px;color:#939393;width:60%">
				<select id="shi" style=";margin-top:12px;float:right;width:30%;font-size:14px;color:#939393;"> 
				  <option value ="1">请选择</option>
				</select>  
				<select id="sheng" style=";margin-top:12px;float:right;width:30%;font-size:14px;color:#939393;margin-right:10px;"> 
				  <option value ="1">请选择</option>
				</select>  
			</div>
		</div>
	</div>
	<div onclick="window.location.href='#'" style="height:40px;width:100%;background:#FFF;">
		<div style="width:90%;border-top:1px solid #f5f5f7">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:14px;color:#373737;line-height:24px;">银行预留手机号：</div>
			</div>
			<div id="mobile" style="float:left;line-height:40px;font-size:14px;"></div>
			<div style="float:right;line-height:40px;font-size:13px;color:#939393">修改注册手机号 </div>
		</div>
	</div>
	<div onclick="window.location.href='#'" style="height:40px;width:100%;background:#FFF;">
		<div style="width:90%;border-top:1px solid #f5f5f7">
			<div align="left" style="float:left;color:#383838;padding:8px 0 8px 0">
				<div style="font-size:14px;color:#373737;line-height:24px;">验证码：</div>
			</div>
			<div style="float:left;line-height:38px;font-size:14px;">
				<input id="sms"  placeholder="请输入验证码" type="text" style="font-size:14px;height:38px;width:100%">
			</div>
			<div id="getcode" style="float:right;line-height:40px;font-size:13px;color:#939393">获取验证码 </div>
		</div>
	</div>
	<div align="center" style="width:90%;margin-top:30px;">
		<input id="ok" value="立刻添加" type="button" style="height:45px;width:100%;color:#FFF;background:#fd536d;border-radius:10px;font-size:16px;">
	</div>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> 
<script> 
$(document).ready(function(){
	var sheng;
	var shi;
	var ticket;
	var accountName;
	var mobile;
	var ip2;
	var ip_l=returnCitySN["cip"];
	$.getJSON("#(path)/card/bankCode",function(datainfo) {
		console.log(datainfo); 
		$.each(datainfo.data, function(i, item){ 
			$("#bank").append("<option value ='"+item.code+"'>"+item.name+"</option>");
		});
	});
	$.getJSON("#(path)/sys/area",function(datainfo2) {
		console.log(datainfo2); 
		sheng = datainfo2.province;
		shi = datainfo2.city;
		$.each(sheng, function(i, item){ 
			$("#sheng").append("<option value ='"+item.ProID+"'>"+item.name+"</option>");
		});
		$("#sheng").change(function(){
			$("#shi").empty();
			$.each(shi, function(i, item){ 
				if(item.ProID==$("#sheng").val())
					$("#shi").append("<option value ='"+item.CityID+"'>"+item.name+"</option>");
			});
		});
	}); 
	$.getJSON("#(path)/user/info?token=#(session.token??)",function(datainfo3) {
		console.log(datainfo3); 
		accountName = datainfo3.data.info.real_name;
		mobile = datainfo3.data.info.mobile;
		$("#real_name").html(datainfo3.data.info.real_name.substring(0, 1)+"**");
		$("#cert_num").html(datainfo3.data.info.cert_num.substring(0, 4)+"******"+datainfo3.data.info.cert_num.substring(14, 18));
		$("#mobile").html(datainfo3.data.info.mobile.substring(0, 3)+"****"+datainfo3.data.info.mobile.substring(7, 11));
	});
	$("#getcode").click(function(){
		var bankCode = $("#bank").val();
		var bankName = $("#bank").find("option:selected").text();
		var bankAccount = $("#bankAccount").val();
		var province = $("#sheng").val();
		var city = $("#shi").val();
		var url1 = "#(path)/card/bindBankCard?token=#(session.token??)&bankName=" + bankName + "&bankCode=" + bankCode +"&bankAccount=" + bankAccount + "&accountName=" +accountName +"&mobile="+mobile+"&province="+province+"&city=" + city + "&ip="+ip_l;
		
		if(bankCode==1||province==1||city==1||bankAccount==""){
			alert("信息未填写完整");
		}else{
			$.getJSON(url1,function(datainfo4) {
				//console.log(datainfo4);
				if(datainfo4.code=='success'){
					ticket = datainfo4.data.ticket;
					ip2 = datainfo4.data.id;
					console.log(ticket);
					console.log(ip2);  
				}else{
					layer.msg(datainfo4.msg,{icon:2,time:1000}); 
				}
			}); 
		}
	});
	$("#ok").click(function(){
		var sms = $("#sms").val();
		var url2 = "#(path)/card/bindBankCardAdvance?token=#(session.token??)&ticket=" + ticket + "&id=" +ip2+"&sms="+sms + "&ip="+ip_l;
		$.getJSON(url2,function(datainfo5) {
			if(datainfo5.code=='success'){
				$.getJSON("#(path)/user/setPayPassword?token=#(session.token??)",function(datainfo5){
					console.log(datainfo5); 
					url6 = datainfo5.data.url;
					window.location.href=url6;
				});
				
			}else{
				layer.msg(datainfo5.msg,{icon:2,time:1000}); 
			}
		});
	}); 
});
</script>
</body>